<link rel="stylesheet" href="${ctx}/static/css/zTreeStyle/zTreeStyle.css" type="text/css">
<div class="warpper">
    <div class="title">文章 - 文章列表</div>
    <div class="content">
        <div class="category fl">
            <div style="border-bottom: 1px solid #E4EAEC;padding:8px;font-size: 13px;"><i class="icon icon-desktop"></i> 分类列表</div>
            <ul id="tree" class="ztree" style="width:260px; overflow:auto;"></ul>
        </div>
        <div class="list-div fl">
            <table cellpadding="0" cellspacing="0" border="0" data-cols="13">
                <thead>
                <tr>
                    <th width="6%">文章标题</th>
                    <th width="10%">文章分类</th>
                    <th width="8%">是否显示</th>
                    <th width="5%">添加日期</th>
                    <th width="22%"><div class="handle">操作</div></th>
                </tr>
                </thead>
                <tbody></tbody>
                <script id="table_template" type="text/x-jquery-tmpl">
                        <tr>
                            <td>{{= title}}</td>
                            <td>{{}}</td>
                            <td>{{}}</td>
                            <td>{{}}</td>
                            <td class="handle">
                                <div class="tDiv a4">
                                    <a href="admin_logs.php?act=list&id=41" title="查看日志" class="btn_see"><i class="sc_icon sc_icon_see"></i>查看日志</a>
                                    <a id="url" href="javascript:;" title="编辑" class="btn_edit" data-url="${ctx}/admin/user/update.html?id={{= id}}"><i class="icon icon-edit"></i>编辑</a>
                                    <a href="javascript:;" title="移除" class="btn_trash" data-id="{{= id}}"><i class="icon icon-trash"></i>移除</a>
                                </div>
                            </td>
                        </tr>
                        </script>
                <tfoot>
                <tr>
                    <td colspan="10">
                        <div class="fl">
                            <div class="refresh">
                                <div class="refresh_tit" title="刷新数据"><i class="icon icon-spin icon-refresh"></i></div>
                                <div class="refresh_span">刷新 - 共 <span class="rows">0</span> 条记录</div>
                            </div>
                        </div>
                        <div class="fr">
                            <ul class="page" id="page" data-url="${ctx}/article/page"></ul>
                        </div>
                    </td>
                </tr>
                </tfoot>
            </table>
        </div>
    </div>
</div>
<script type="text/javascript" src="${JS_PATH}/page.js"></script>
<script type="text/javascript">
    $(function(){
        $(window).resize(function() {
            $("div.list-div").css("width", ($(document.body).width() - 460) +"px");
        });
        $("div.list-div").css("width", ($(document.body).width() - 460) +"px");
    });

    var zTree;
    var demoIframe;

    var setting = {
        view: {
            dblClickExpand: false,
            showLine: false,
            selectedMulti: false
        },
        data: {
            simpleData: {
                enable:true,
                idKey: "id",
                pIdKey: "pId",
                rootPId: ""
            }
        },
        callback: {
            beforeClick: function(treeId, treeNode) {
                var zTree = $.fn.zTree.getZTreeObj("tree");
                if (treeNode.isParent) {
                    zTree.expandNode(treeNode);
                    return false;
                } else {
                    demoIframe.attr("src",treeNode.file + ".html");
                    return true;
                }
            }
        }
    };

    var zNodes =[
        {id:1, pId:0, name:"[core] 基本功能 演示", open:true},
        {id:103, pId:1, name:"不显示 连接线", file:"core/noline"},
        {id:104, pId:1, name:"不显示 节点 图标", file:"core/noicon"},
        {id:107, pId:1, name:"自定义字体", file:"core/custom_font"},


        {id:6, pId:0, name:"其他扩展功能 演示", open:false},
        {id:601, pId:6, name:"隐藏普通节点", file:"exhide/common"},
        {id:602, pId:6, name:"配合 checkbox 的隐藏", file:"exhide/checkbox"},
        {id:603, pId:6, name:"配合 radio 的隐藏", file:"exhide/radio"}
    ];

    $(document).ready(function(){
        var t = $("#tree");
        t = $.fn.zTree.init(t, setting, zNodes);
        demoIframe = $("#testIframe");
        demoIframe.bind("load", loadReady);
        var zTree = $.fn.zTree.getZTreeObj("tree");
        zTree.selectNode(zTree.getNodeByParam("id", 101));

        page.init(1 ,15 , {});

    });

    function loadReady() {
        var bodyH = demoIframe.contents().find("body").get(0).scrollHeight,
                htmlH = demoIframe.contents().find("html").get(0).scrollHeight,
                maxH = Math.max(bodyH, htmlH), minH = Math.min(bodyH, htmlH),
                h = demoIframe.height() >= maxH ? minH:maxH ;
        if (h < 530) h = 530;
        demoIframe.height(h);
    }

</script>